package com.bnuz.vtl.service;

import com.bnuz.vtl.model.Subject;
import com.bnuz.vtl.repo.SubjectRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SubjectService implements BaseService<Subject, String> {

    @Autowired
    private SubjectRepo subjectRepo;

    @Override
    public Subject save(Subject subject) {
        return subjectRepo.save(subject);
    }

    @Override
    public void deleteById(String subjectId) {
        subjectRepo.deleteById(subjectId);
    }

    @Override
    public List<Subject> findAll() {
        return subjectRepo.findAll();
    }

    @Override
    public Subject findById(String subjectId) {
        return subjectRepo.findById(subjectId).orElse(null);
    }
}
